﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BL.data
{
    class InterestPointDataSet
    {
        private DataSet m_ds;

        public InterestPointDataSet(DataSet ds)
        {
            m_ds = ds;
        }

        public List<InterestPoint> ToIntrestPoints()  
        {
            List<InterestPoint> interestPoints = new List<InterestPoint>();

            if (m_ds.Tables.Count > 0)
            {
                DataTable dt = m_ds.Tables[0];

                foreach (DataRow dr in dt.Rows)
                {
                    InterestPoint interestPoint = new InterestPoint(Convert.ToInt32(dr["id"]),
                                                                    dr["name"].ToString());

                    interestPoints.Add(interestPoint);
                }
            }

            return interestPoints;
        }
    }
}
